package com.qf.j2112.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ProjectName: YiZhanXiYi
 * @Package: com.qf.j2112.config
 * @ClassName: RabbitMqConfig
 * @Author: 宋晓博
 * @Description: description
 * @Date: 2022/4/22 15:41
 * @Version: 1.0
 */
@Configuration
public class RabbitMqConfig {

    @Bean
    public Queue reduceMoneyQueue(){
        return new Queue("reduceMoneyQueue");
    }

    @Bean
    public Queue chargeQueue(){
        return new Queue("chargeQueue");
    }

    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange("topicExchange");
    }

    @Bean
    public Binding bindingExchange(Queue reduceMoneyQueue, TopicExchange topicExchange){
        return BindingBuilder.bind(reduceMoneyQueue).to(topicExchange).with("reduceMoneyQueue");
    }

    @Bean
    public Binding bindingExchange2(Queue chargeQueue, TopicExchange topicExchange){
        return BindingBuilder.bind(chargeQueue).to(topicExchange).with("chargeQueue");
    }
}
